package com.you.atlas.web.place.module;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.citrus.turbine.Context;
import com.alibaba.citrus.turbine.Navigator;
import com.you.atlas.biz.place.service.PlaceQueryService;
import com.you.place.dal.dao.dataobject.PlaceDO;

public abstract class PlaceModule {

    @Autowired
    private PlaceQueryService placeQueryService;

    public boolean checkPlace(Long placeId, Navigator navigator, Context context) {
        PlaceDO placeDO = placeQueryService.find(placeId);
        if (placeDO == null) {
            navigator.redirectTo("placeModule").withTarget("error");
            return false;
        }
        context.put("placeDO", placeDO);
        return true;
    }
}
